package com.tvserials.notification.parser;

import com.tvserials.notification.vo.SourceType;

import java.util.Arrays;
import java.util.List;

/**
 * Created by Alex on 30.03.2014.
 */
public class PageParserFactory {
    private static final List<PageParser> parsers = Arrays.asList(PageParserFactory.getPageParser(SourceType.LOST_FILM),
            PageParserFactory.getPageParser(SourceType.NEW_STUDIO));

    public static final int TIMEOUT = 7 * 1000;//7sec

    /**
     * Get parser based on source type
     *
     * @param type
     * @return
     */
    public static PageParser getPageParser(SourceType type) {
        if (SourceType.LOST_FILM.equals(type)) {
            return new LostFilmHtmlPageParser();
        } else if (SourceType.NEW_STUDIO.equals(type)) {
            return new NewStudioHtmlPageParser();
        } else if (SourceType.ALL.equals(type)) {
            return new AllHtmlPageParser();
        } else if (SourceType.SEASON_VAR.equals(type)) {
            return new SeasonVarHtmlPageParser();
        }
        return new MockPageParser();
    }

    public static List<PageParser> getAllParsers() {
        return parsers;
    }
}
